package com.employ.job.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.employ.common.annotation.Log;
import com.employ.common.core.controller.BaseController;
import com.employ.common.core.domain.AjaxResult;
import com.employ.common.enums.BusinessType;
import com.employ.job.domain.EmpCareerGuides;
import com.employ.job.service.IEmpCareerGuidesService;
import com.employ.common.utils.poi.ExcelUtil;
import com.employ.common.core.page.TableDataInfo;

/**
 * 就业指导Controller
 * 
 * @author ruoyi
 * @date 2025-02-24
 */
@RestController
@RequestMapping("/job/guides")
public class EmpCareerGuidesController extends BaseController
{
    @Autowired
    private IEmpCareerGuidesService empCareerGuidesService;

    /**
     * 查询就业指导列表
     */
    @PreAuthorize("@ss.hasPermi('job:guides:list')")
    @GetMapping("/list")
    public TableDataInfo list(EmpCareerGuides empCareerGuides)
    {
        startPage();
        List<EmpCareerGuides> list = empCareerGuidesService.selectEmpCareerGuidesList(empCareerGuides);
        return getDataTable(list);
    }

    /**
     * 导出就业指导列表
     */
    @PreAuthorize("@ss.hasPermi('job:guides:export')")
    @Log(title = "就业指导", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, EmpCareerGuides empCareerGuides)
    {
        List<EmpCareerGuides> list = empCareerGuidesService.selectEmpCareerGuidesList(empCareerGuides);
        ExcelUtil<EmpCareerGuides> util = new ExcelUtil<EmpCareerGuides>(EmpCareerGuides.class);
        util.exportExcel(response, list, "就业指导数据");
    }

    /**
     * 获取就业指导详细信息
     */
    @PreAuthorize("@ss.hasPermi('job:guides:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(empCareerGuidesService.selectEmpCareerGuidesById(id));
    }

    /**
     * 新增就业指导
     */
    @PreAuthorize("@ss.hasPermi('job:guides:add')")
    @Log(title = "就业指导", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody EmpCareerGuides empCareerGuides)
    {
        return toAjax(empCareerGuidesService.insertEmpCareerGuides(empCareerGuides));
    }

    /**
     * 修改就业指导
     */
    @PreAuthorize("@ss.hasPermi('job:guides:edit')")
    @Log(title = "就业指导", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody EmpCareerGuides empCareerGuides)
    {
        return toAjax(empCareerGuidesService.updateEmpCareerGuides(empCareerGuides));
    }

    /**
     * 删除就业指导
     */
    @PreAuthorize("@ss.hasPermi('job:guides:remove')")
    @Log(title = "就业指导", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(empCareerGuidesService.deleteEmpCareerGuidesByIds(ids));
    }
}
